package com.testfileupload.uploadimg.design.builder.car;

import com.testfileupload.uploadimg.design.builder.car.builder.BWMBuilder;
import com.testfileupload.uploadimg.design.builder.car.builder.BenzBuilder;
import com.testfileupload.uploadimg.design.builder.car.model.BenzModel;
import com.testfileupload.uploadimg.design.builder.car.model.CarModel;

import java.util.ArrayList;

//导演类，封装各种类型汽车
public class Director {
    private ArrayList<String> sequence = new ArrayList<>();

    private BenzBuilder benzBuilder = new BenzBuilder();

    private BWMBuilder bwmBuilder = new BWMBuilder();

    //a类型benz，只有start和stop
    public BenzModel getBenzModelA() {
        this.sequence.clear();
        this.sequence.add("start");
        this.sequence.add("stop");
        this.benzBuilder.setSequence(sequence);
        CarModel carModel = this.benzBuilder.getCarModel();
        return (BenzModel) carModel;
    }

    //b类型，先引擎，再开始再停止
    public BenzModel getBenzModelB() {
        this.sequence.clear();
        this.sequence.add("engineBoom");
        this.sequence.add("start");
        this.sequence.add("stop");
        this.benzBuilder.setSequence(sequence);
        return (BenzModel) this.benzBuilder.getCarModel();
    }
}
